//获取实名认证信息
$(function () {
    var merchant_confirm = sessionStorage.getItem("merchant_confirm");
    var realname_confirm = sessionStorage.getItem("realname_confirm");
    var img_confirm = sessionStorage.getItem("img_confirm");
    var hide_confirm = sessionStorage.getItem("hide_confirm");
    //        商户认证
    if (merchant_confirm == "0") {
        $("#shrz").html("未认证");
    } else {
        $("#shrz").html("已认证");
        //$("#shrz").parent().parent().removeAttr("href");
    }
    //        实名认证
    if (img_confirm == "0") {
        $("#rz").html("未认证");
    } else if (img_confirm == "2") {
        $("#rz").html("审核中");
        $("#rz").parent().parent().removeAttr("href");
    } else if (img_confirm == "3") {
        $("#rz").html("审核失败");
    } else {
        $("#rz").html("已认证");
        $("#rz").parent().parent().removeAttr("href");
    }
    //认证隐藏 
    if (hide_confirm == "1") {
        $("#smrz_tit").css("display", "none");
        $("#shrz_tit").css("display", "none");
    }

    var token = sessionStorage.getItem("token");
    var login_name = sessionStorage.getItem("login_name");
    var method1 = "get_real_name";
    var method2 = "get_user_msg";
    var d = {},
        c = {};
    d.method = method1;
    d.token = token;
    c.method = method2;
    c.token = token;
    $.ajax({
        type: "post",
        url: "http://www.rice.com/app/api/h5_access",
        data: d,
        dataType: "json",
        success: function (result) {
            if (result.status == "1") {
                var data = result.data.data;
                console.log(data);
                $("#tel").html(data.phone);
                sessionStorage.setItem("idCard", data.idCard);
                sessionStorage.setItem("accountNo", data.accountNo);
                sessionStorage.setItem("accountName", data.accountName);
                sessionStorage.setItem("bankName", data.bankName);
                sessionStorage.setItem("phone", data.phone);
                $("#account").html("已绑定").removeAttr("href");
                $("#rz").html("已认证");
            } else if (result.status == "2") {
                alert(result.message);
                location.href = "login.html";
            } else {
                $("#tel").html(login_name);
                $("#account").html("未绑定");
                $("#rz").html("未认证");
                alert(result.message);
            }

        }

    });
    $.ajax({
        type: 'post',
        url: 'http://www.rice.com/app/api/h5_access',
        data: c,
        dataType: "json",
        success: function (result) {
            if (result.status == "1") {
                var data1 = result.data;
                // console.log(data);
                $('#recommend').html(data1.recommend);
            } else {
                alert(result.message);
                location.href = "login.html";
            }
        }
    })
})